<?php

namespace App\Http\Resources\Admins;

use Illuminate\Http\Resources\Json\JsonResource;

class UserResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'        => $this['id'],
            'nickname'  => $this['nickname'],
            'mobile'    => $this['mobile'],
            'name'      => $this['name'],
            'identity'  => $this['identity'],
            'address'   => $this['address'],
            'sign_in'   => $this['sign_in'],
            'is_admin'  => $this['is_admin'],
            'invite_name' => $this['invite'] ? $this['invite_user']['name'] : '',
            'created_at'    => $this['created_at'],
        ];
    }
}
